
#include <AmountFormat.h>
#include <Amount.h>
#include <Unit.h>
#include <Formatter.h>

AmountFormat::AmountFormat(Amount & amount, OutFormat& outFormat)
	:amount_m(amount), outFormat_m(outFormat)
{
}

std::ostream& operator << (std::ostream& out, AmountFormat& amountFormat)
{
	amountFormat.amount_m.formatString(out, amountFormat.outFormat_m);
	return out;
}

OutFormat& OutPutFormatInAllUnit::getOutPutFormat()
{
	static OutPutFormatInAllUnit outPutFormatInAllUnit;
	return outPutFormatInAllUnit;
}

void OutPutFormatInAllUnit::outPutFormat(std::ostream& out, const Amount& amount) 
{
	Formatter formatter(amount, out);
	formatter.formatStringInAllUnit();
}

OutFormat& OutPutFormatInBaseUnit::getOutPutFormat()
{
	static OutPutFormatInBaseUnit outPutFormatInBaseUnit;
	return outPutFormatInBaseUnit;
}

void OutPutFormatInBaseUnit::outPutFormat(std::ostream& out, const Amount& amount) 
{
	Formatter formatter(amount, out);
	formatter.formatStringInBaseUnit();
}



